package com.quasar.hpatient.view.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quasar.hpatient.R;
import com.quasar.hpatient.model.custommodel.DrugsAdjustmentData;
import com.quasar.hpatient.model.custommodel.PharmacyRecordDataBean;
import com.quasar.hpatient.model.httpmodel.AnotherResult;
import com.vise.log.ViseLog;

/**
 * name : lishuai
 * time : 2017/12/26
 * title:  调药记录
 */

public class PharmacyRecordAdapter extends BaseQuickAdapter<DrugsAdjustmentData, BaseViewHolder> {
    public PharmacyRecordAdapter() {
        super(R.layout.pharmacy_record_items);
    }


    @Override
    protected void convert(BaseViewHolder helper, DrugsAdjustmentData item) {

        //医院
        if (item.getHospitalName() != null && item.getHospitalName().length() > 0) {
            helper.setText(R.id.title, "\t" + item.getHospitalName() + "\t");
        } else {
            helper.setText(R.id.title, "");
        }

        TextView textName = helper.getView(R.id.doctor);
        if (item.getDoctorName() != null && item.getDoctorName().length() > 0) {
            textName.setText("\t" + item.getDoctorName());
        } else {
            textName.setText("\t" + "本人");
        }
        StringBuffer buf = new StringBuffer();
        buf.append(item.getPrescription());
        helper.setText(R.id.desc, "" + buf.toString().replaceAll("<br/>", "")); //内容

        if (item.getEidtMessage() != null && item.getEidtMessage().length() > 0) {
            helper.setText(R.id.demo, item.getEidtMessage().replaceAll("<br/>", "\n") + "\n");
        }
        helper.setText(R.id.time, "\t" + item.getEditTime().substring(0, item.getEditTime().length() - 3));
    }
}
